//
//  WmcEditTeamMemberSpecificItemVm.swift
//  YPWatermarkCamera
//
//  Created by yupao_ios_macmini06 on 2022/9/15.
//

import Foundation

class WmcEditTeamMemberSpecificItemVM: WmcEditTeamMemberInfoVM {
    var detail: WmcTeamMemberDetailModel?

    /// 更新团队成员信息
    /// - Parameters:
    ///   - teamId: 团队id
    ///   - memberId: 成员id
    ///   - remark: 成员昵称
    /// - Returns: description
    func updateMemberInfo(remark: String?, succeed: (() -> Void)?) {
        guard let teamId = detail?.teamId, let memberId = detail?.memberId, let remark = remark, let succeed = succeed else { return }
        WmcHudManager.loading()
        WmcMediaTeamManagerAPI.updateMemberInfo(teamId: teamId, memberId: memberId, remark: remark).subscribe { _ in
            WmcHudManager.toast("修改成功")
            WmcHudManager.dismiss()
            succeed()
        } onError: { error in
            WmcHudManager.toast(error)
            WmcHudManager.dismiss()
        }.disposed(by: rx.disposeBag)
    }
}
